Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ASImageNode] Move to class method of displayWithParameters:isCancelled: for drawing #244

Merged
merged 2 commits into from
May 9, 2017

Conversation

maicki
Copy link
Contributor

@maicki maicki commented May 5, 2017

In our effort going forward to make the framework safer to work with and to enable future optimizations like lifting up caching into a generalized way out of ASImageNode and ASTextNode specific ways this PR will remove the instance version of displayWithParameters:isCancelled: in favor of using the class method.

@maicki maicki force-pushed the MSStaticDrawingImageNode branch 2 times, most recently from 3d8298a to 5356304 Compare May 5, 2017 23:18
Copy link
Member

@garrettmoon garrettmoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to be cast aside in favor of returning self for the draw parameters?

@@ -833,6 +831,11 @@ - (CGRect)threadSafeBounds
return _threadSafeBounds;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably call _locked_threadSafeBounds instead?

@@ -137,7 +148,7 @@ @implementation ASImageNode
void (^_displayCompletionBlock)(BOOL canceled);

// Drawing
ASImageNodeDrawParameters _drawParameter;
//ASImageNodeDrawParameters _drawParameter;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete?

Copy link
Member

@Adlai-Holler Adlai-Holler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good! Safe, fast, simple.

Over time these parameters classes could:

  • Have public interface/be subclassable. Node classes could specify their parameters subclasses through +drawParametersClass
  • Be generalized into immutable "NodeState"-type objects that capture the info we need for layout/display/logging/etc.

There's a ton we can build on top of this, but getting rid of the hacky instance draw methods is the first step. Merge at will.

@maicki maicki force-pushed the MSStaticDrawingImageNode branch from 5356304 to 30e9277 Compare May 9, 2017 18:09
@maicki maicki force-pushed the MSStaticDrawingImageNode branch from f4bdb0f to 6723643 Compare May 9, 2017 18:14
@maicki maicki merged commit 3738f1f into master May 9, 2017
@maicki maicki deleted the MSStaticDrawingImageNode branch May 9, 2017 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants